//
//  VCD.swift
//  TestPresentingViewController
//
//  Created by 李煜 on 2024/2/20.
//https://blog.csdn.net/fanjiarong_919/article/details/126139610?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-1-126139610-blog-48456177.235%5Ev43%5Epc_blog_bottom_relevance_base3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-1-126139610-blog-48456177.235%5Ev43%5Epc_blog_bottom_relevance_base3&utm_relevant_index=2
//关于presentingViewController的测试
//

import UIKit
//入口->TabA->naviA(root:A)-container->naviB(root:B)-modal->C->(container:D)
//D.presentingViewController == TabA

class VCD: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.backgroundColor = .systemMint
    }
//When you present a view controller modally (either explicitly or implicitly) using the present(_:animated:completion:) method, the view controller that was presented has this property set to the view controller that presented it. If the view controller was not presented modally, but one of its ancestors was, this property contains the view controller that presented the ancestor. If neither the current view controller or any of its ancestors were presented modally, the value in this property is nil.
//当你使用present(:animated:completion:)方法(显示或隐式)modal一个视图控制器b时,被呈现者b会将其呈现者a设置为他的`presentingViewController`属性.若一个控制器没有被呈现,但其祖先被呈现了,那么此属性就是指呈现其祖先的那个控制器.若当前控制器或其任意祖先都没被呈现,那么此属性值为nil.
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesBegan(touches, with: event)
        print("---VCD.presentingViewController---", self.presentingViewController as Any)
    }
}
